home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 2000
/
MacHack 2000.toast
/
pc
/
The Hacks
/
Softshoe
/
Lisa's Mac Parts
/
Broadcaster
/
BroadcastLink.h
< prev
next >
Wrap
Text File
|
2000-06-23
|
727b
|
38 lines
// BroadcastLink.h
#ifndef BroadcastLink_h
#define BroadcastLink_h
#ifndef ListLink_h
#include "ListLink.h"
#endif
#ifndef Broadcaster_h
#include "Broadcaster.h"
#endif
template < class Protocol >
class BroadcastLink
{
typedef Broadcaster< Protocol > Source;
private:
ListLink< Protocol > link;
public:
BroadcastLink( Protocol& target )
: link( &target )
{}
BroadcastLink( Protocol& target, const Source& source )
: link( &target )
{
source.receivers.Add( link, afterEnd );
}
bool Receiving() const { return link.Owned(); }
void ReceiveNothing() { link.Owner().Remove( link ); }
void ReceiveFrom( const Source& a ) { a.receivers.Add( link, afterEnd ); }
};
#endif